package com.AStarExample
{
	public class Grid
	{
		public var rowNum:int;//行
		public var colNum:int;//咧
		public var startNode:Node;
		public var endNode:Node;
		private var _nodeArr:Array;
		public function Grid($rowNum:int,$colNum:int)
		{
			this.rowNum = $rowNum;
			this.colNum = $colNum;
			
			this._nodeArr = [];
			for(var i:int = 0;i<this.rowNum;i++)
			{
				this._nodeArr[i] = [];
				for(var j:int = 0;j<this.colNum;j++)
				{
					this._nodeArr[i][j] = new Node(i,j);
				}
			}
			
		}
			
			public function getNode(x:int,y:int):Node
			{
				return this._nodeArr[x][y] as Node;
			}
			
			public function setStartNode(x:int,y:int):void
			{
				this.startNode = this._nodeArr[x][y] as Node;
			}
			
			public function setEndNode(x:int,y:int):void
			{
				this.endNode = this._nodeArr[x][y] as Node;
			}
			
			public function setNodeWalkable(x:int,y:int,boo:Boolean):void
			{
				Node(this._nodeArr[x][y]).walkable = boo;
			}
			
			
			
		}
	}
		
